/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mavenrentcars.form;

import com.mavenrentcars.model.Role;
import com.mavenrentcars.model.User;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 *
 * @author serg
 */
public class AccountForm extends GenericForm {

    public String id = "";
    public String email = "";
    public String name = "";
    public String phone = "";
    public String address = "";
    public String gender = "";
    public String drive_length = "";
    public String drive_category = "";
    public Map<String, String> roles = new HashMap<String, String>();

    public AccountForm() {
    }

    public AccountForm(User item) {
        id = Integer.toString(item.getId());
        email = item.getEmail();
        name = item.getUserName();
        phone = Integer.toString(item.getPhone());
        address = item.getAddress();
        gender = item.getGender();
        drive_length = Integer.toString(item.getDriveLength());
        drive_category = item.getDriveCategory();

        Set<Role> list = item.getRoles();
        for (Role role : list) {
            roles.put(Integer.toString(role.getId()), role.getRoleName());
        }
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getDriveLength() {
        return drive_length;
    }

    public void setDriveLength(String drive_length) {
        this.drive_length = drive_length;
    }

    public String getDriveCategory() {
        return drive_category;
    }

    public void setDriveCategory(String drive_category) {
        this.drive_category = drive_category;
    }

    public void setRoles(Map<String, String> roles) {
        this.roles = roles;
    }

    public Map<String, String> getRoles() {
        return this.roles;
    }
}
